package com.alibaba.datax.plugin.reader.elasticsearchreader;

public class Key {
    // 通用配置
    public static final String ENDPOINT = "endpoint";
    public static final String USERNAME = "username";
    public static final String PASSWORD = "password";
    public static final String INDEX = "index";
    public static final String TYPE = "type";
    public static final String BATCH_SIZE = "batchSize";
    public static final String SEARCH_QUERY = "searchQuery";
    public static final String SCROLL_TIME = "scrollTime";
    public static final String SCROLL_SIZE = "scrollSize";
    public static final String TIMEOUT = "timeout";
    public static final String RETRY_COUNT = "retryCount";
    public static final String COLUMN = "column";
    
    // 增量同步配置
    public static final String IS_INCREMENTAL = "isIncremental";
    public static final String INCREMENTAL_COLUMN = "incrementalColumn";
    public static final String LAST_VALUE = "lastValue";
    
    // 性能配置
    public static final String CONCURRENT_THREADS = "concurrentThreads";
    public static final String THROTTLE_LIMIT = "throttleLimit";

    public static String getEndpoint(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(ENDPOINT);
    }

    public static String getUsername(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(USERNAME);
    }

    public static String getPassword(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(PASSWORD);
    }

    public static String getIndex(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(INDEX);
    }

    public static String getType(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(TYPE, "_doc");
    }

    public static int getBatchSize(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getInt(BATCH_SIZE, 1000);
    }

    public static String getSearchQuery(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(SEARCH_QUERY, "{\"query\": {\"match_all\": {}}}");
    }

    public static String getScrollTime(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(SCROLL_TIME, "1m");
    }

    public static int getScrollSize(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getInt(SCROLL_SIZE, 100);
    }

    public static int getTimeout(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getInt(TIMEOUT, 30000);
    }

    public static int getRetryCount(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getInt(RETRY_COUNT, 3);
    }

    public static boolean isIncremental(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getBool(IS_INCREMENTAL, false);
    }

    public static String getIncrementalColumn(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(INCREMENTAL_COLUMN);
    }

    public static String getLastValue(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getString(LAST_VALUE);
    }

    public static int getConcurrentThreads(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getInt(CONCURRENT_THREADS, 1);
    }

    public static long getThrottleLimit(com.alibaba.datax.common.util.Configuration conf) {
        return conf.getLong(THROTTLE_LIMIT, -1L);
    }
}